package com.heisen.file.service.impl;

import com.heisen.base.exception.RRException;
import com.heisen.file.entity.OpFile;
import com.heisen.file.mapper.OpFileMapper;
import com.heisen.file.service.IOpFileService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author sen
 * @since 2024-03-06
 */
@Service
public class OpFileServiceImpl extends ServiceImpl<OpFileMapper, OpFile> implements IOpFileService {

    @Override
    public OpFile getFileByFileId(String fileId) {
        if(StringUtils.isEmpty(fileId)) throw new RRException("fileId  不能为空");
        OpFile byId = this.getById(fileId);
        if(byId == null) throw new RRException("文件对象未找到");
        return byId;
    }
}
